import React, { useEffect } from "react";
import styles from "./index.module.less";
import WithHead from "../message/WithHead";
import { connect } from "react-redux";
import { getAllAcceptLeaveMessageAction } from "@redux/actions02";

const AcceptMessage = (props) => {
    const { getAllAcceptLeaveMessageAction, list } = props;

    useEffect(() => {
        getAllAcceptLeaveMessageAction();
    }, [getAllAcceptLeaveMessageAction]);

    return (
        <div className={styles.accept_message}>
            {list &&
                list.map((item, index) => <WithHead key={index} item={item} />)}
        </div>
    );
};

export default connect(
    (state) => ({ list: state.allAcceptLeaveMessageReducer }),
    { getAllAcceptLeaveMessageAction }
)(AcceptMessage);
